/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ultrasoft.farmasoft.domain;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "parameter")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Parameter.findAll", query = "SELECT p FROM Parameter p"),
    @NamedQuery(name = "Parameter.findByParameterId", query = "SELECT p FROM Parameter p WHERE p.parameterId = :parameterId"),
    @NamedQuery(name = "Parameter.findByName", query = "SELECT p FROM Parameter p WHERE p.name = :name"),
    @NamedQuery(name = "Parameter.findByDetail", query = "SELECT p FROM Parameter p WHERE p.detail = :detail"),
    @NamedQuery(name = "Parameter.findByUnit", query = "SELECT p FROM Parameter p WHERE p.unit = :unit"),
    @NamedQuery(name = "Parameter.findByOrder", query = "SELECT p FROM Parameter p WHERE p.orderParameter = :orderParameter"),
    @NamedQuery(name = "Parameter.findByPharmacyId", query = "SELECT p FROM Parameter p WHERE p.pharmacyId.pharmacyId= :pharmacyId"),
    @NamedQuery(name = "Parameter.findDistinctTypeParameterId", query = "SELECT DISTINCT p.typeParameterId.typeParameterId,p.typeParameterId.name, p.typeParameterId.detail FROM Parameter p WHERE p.pharmacyId.pharmacyId= :pharmacyId"),
    @NamedQuery(name = "Parameter.findByPharmacyIdAndTypeParameterId", query = "SELECT p FROM Parameter p WHERE p.typeParameterId.typeParameterId= :typeParameterId AND p.pharmacyId.pharmacyId= :pharmacyId"),    
    
    @NamedQuery(name = "Parameter.findByActive", query = "SELECT p FROM Parameter p WHERE p.active = :active")})
public class Parameter implements Serializable {
    private static final long serialVersionUID = 1L;
    /*
    @Id
    @Basic(optional = false)
    @Column(name = "parameterId")*/
    @Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Short parameterId;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @Column(name = "valueParameter")
    private String valueParameter;
	@Basic(optional = false)
    @Column(name = "detail")
    private String detail;
    @Basic(optional = false)
    @Column(name = "unit")
    private String unit;
    @Basic(optional = false)
    @Column(name = "orderParameter")
    private short orderParameter;
    @Basic(optional = false)
    @Column(name = "active")
    private boolean active;
    @JoinColumn(name = "pharmacyId", referencedColumnName = "pharmacyId")
    @ManyToOne
    private Pharmacy pharmacyId;
    @JoinColumn(name = "typeParameterId", referencedColumnName = "typeParameterId")
    @ManyToOne
    private Typeparameter typeParameterId;

    public Parameter() {
    }

    public Parameter(Short parameterId) {
        this.parameterId = parameterId;
    }

    public Parameter(Short parameterId, String name,String valueParameter, String detail, String unit, short orderParameter, boolean active) {
        this.parameterId = parameterId;
        this.name = name;
        this.valueParameter = valueParameter;
        this.detail = detail;
        this.unit = unit;
        this.orderParameter = orderParameter;
        this.active = active;
    }
    
    

    public Short getParameterId() {
        return parameterId;
    }

    public void setParameterId(Short parameterId) {
        this.parameterId = parameterId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValueParameter() {
		return valueParameter;
	}

	public void setValueParameter(String valueParameter) {
		this.valueParameter = valueParameter;
	}
	
    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public short getOrderParameter() {
        return orderParameter;
    }

    public void setOrderParameter(short orderParameter) {
        this.orderParameter = orderParameter;
    }

    public boolean getActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public Pharmacy getPharmacyId() {
        return pharmacyId;
    }

    public void setPharmacyId(Pharmacy pharmacyId) {
        this.pharmacyId = pharmacyId;
    }

    public Typeparameter getTypeParameterId() {
        return typeParameterId;
    }

    public void setTypeParameterId(Typeparameter typeParameterId) {
        this.typeParameterId = typeParameterId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (parameterId != null ? parameterId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Parameter)) {
            return false;
        }
        Parameter other = (Parameter) object;
        if ((this.parameterId == null && other.parameterId != null) || (this.parameterId != null && !this.parameterId.equals(other.parameterId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ultrasoft.farmasoft.domain.Parameter[ parameterId=" + parameterId + " ]";
    }
    
}
